package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.vo.CarModelVO;
import com.subaru.common.query.PageResult;
import com.mhc.suzuki.dal.model.CarModelDO;
import com.mhc.suzuki.dal.query.CarModelQuery;
import com.mhc.suzuki.dal.mapper.ext.CarModelExtMapper;
import com.mhc.suzuki.manager.CarModelManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


/**
 * Manager for CarModel.
 */

@Component
public class CarModelManagerImpl implements CarModelManager{

    
    @Autowired
    protected CarModelExtMapper carModelExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(CarModelQuery query){
        return carModelExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(CarModelQuery query){
        return carModelExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(CarModelDO record){
        return carModelExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(CarModelDO record){
        return carModelExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<CarModelDO> selectByQuery(CarModelQuery query){
        return carModelExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<CarModelDO> selectByQueryWithPage(CarModelQuery query) {
        PageResult<CarModelDO> result = new PageResult<CarModelDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public CarModelDO selectByPrimaryKey(Long id){
        return carModelExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( CarModelDO record,  CarModelQuery query){
        return carModelExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( CarModelDO record,  CarModelQuery query){

        return carModelExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(CarModelDO record){
        return carModelExtMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<CarModelVO> selectListByQuery(Map<String, ?> paramMap) {
        return carModelExtMapper.selectListByQuery(paramMap);
    }
}